<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>小圳博客-注册</title>
    <link rel="stylesheet" href="../static/lib/semantic/dist/semantic.min.css"/>
    <link rel="stylesheet" href="../static/css/me.css">
    <link rel="stylesheet" th:href="@{/css/global.css}"/>
    <link rel="stylesheet" th:href="@{/css/login.css}"/>
</head>
<body>
<!-- 导航 -->
<nav th:replace="_fragments :: menu(7)" class="ui inverted attached segment m-padded-tb-mini m-shadow-small">
    <div class="ui container">
        <div class="ui inverted secondary stackable menu">
            <h2 class="ui teal header item">小圳博客</h2>
            <link rel="shortcut icon" href="../static/image/关于我.jpg" type="image/x-icon">
            <a href="#" class="m-item item m-mobile-hide"><i class="home icon"></i>首页</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="idea icon"></i>分类</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="tags icon"></i>标签</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="clone icon"></i>归档</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="info icon"></i>关于我</a>
            <div class="right m-item m-mobile-hide menu">
                <div class="centre m-item right item m-mobile-hide">
                    <div class="ui icon input">
                        <input type="text" placeholder="Search..."/>
                        <i class="search link icon"></i>
                    </div>
                </div>
            </div>
            <a href="#" class="m-item item m-mobile-hide"><i class="info icon"></i>登录</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="info icon"></i>注册</a>
        </div>
        <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
            <i class="sidebar icon"></i>
        </a>
    </div>
</nav>


<div class="m-container-small m-padded-tb-massive" style="max-width: 30em !important;">
    <div class="ui container">
        <div class="ui middle aligned center aligned grid">
            <div class="column">
                <h2 class="ui teal image header">
                    <div class="content">
                        管理后台
                    </div>
                </h2>
                <!--            th:action 把对应信息提交到指定地址    -->
                <form class="ui large form" method="post" action="#" th:action="@{/register}">
                    <div class="ui segment">
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="user icon"></i>
                                <input type="text" name="username" placeholder="请输入您的账号"
                                       th:class="|form-control ${usernameMsg!=null?'is-invalid':''}|"
                                       th:value="${user != null ? user.username : ''}">
                                <div class="invalid-feedback" th:text="${usernameMsg}">
                                    该账号已存在
                                </div>
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock icon"></i>
                                <input type="password" name="password" placeholder="请输入您的密码"
                                       th:value="${user != null ? user.password : ''}">
                                <div class="invalid-feedback" th:text="${passwordMsg}">
                                    密码格式错误！
                                </div>
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock icon"></i>
                                <input placeholder="请再次输入密码"
                                       th:value="${user != null ? user.password : ''}">
                                <div class="invalid-feedback" th:text="${passwordMsg}">
                                    两次密码输入不一样！
                                </div>
                            </div>
                        </div>
                        <div class="field">
                            <div class="ui left icon input">
                                <i class="lock icon"></i>
                                <input type="email" name="email" placeholder="请输入您的邮箱"
                                       th:value="${user != null ? user.email : ''}">
                                <div class="invalid-feedback" th:text="${emailMsg}">
                                    邮箱已经注册！
                                </div>
                            </div>
                        </div>
                        <button class="ui fluid large teal submit button">注 册</button>
                    </div>


                    <div class="ui error mini message"></div>
                    <div class="ui mini negative message" th:unless="${#strings.isEmpty(message)}" th:text="${message}">
                        用户名和密码错误
                    </div>
                </form>

            </div>
        </div>
    </div>
</div>

<!--/*/<th:block th:replace="admin/_fragments :: script">/*/-->
<script src="../static/lib/jquery-3.2.1/jquery-3.2.1.min.js"></script>
<script src="../static/lib/semantic/dist/semantic.min.js"></script>
<!--/*/</th:block>/*/-->

<script>
    $('.ui.form').form({
        fields: {
            username: {
                identifier: 'username',
                rules: [{
                    type: 'empty',
                    prompt: '请输入用户名'
                }]
            },
            password: {
                identifier: 'password',
                rules: [{
                    type: 'empty',
                    prompt: '请输入密码'
                }]
            },
            email: {
                identifier: 'email',
                rules: [{
                    type: 'empty',
                    prompt: '请输入邮箱'
                }]
            }
        }
    });
</script>
</body>
</html>